package com.sansecy.customview.activity;

import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.sansecy.customview.R;
import com.sansecy.customview.view.progress.CircleProgress;

import java.util.Random;

public class ProgressViewActivity extends AppCompatActivity implements View.OnClickListener {

    private CircleProgress mCircleProgress;
    private Random mRandom;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_progress_view);
        mCircleProgress = findViewById(R.id.circle_progress);
        mCircleProgress.setOnClickListener(this);
        mRandom = new Random();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.circle_progress:
                mCircleProgress.setValue(mRandom.nextFloat() * mCircleProgress.getMaxValue());
                break;
        }
    }
}
